//
// Created by castle on 2020/9/10.
//

#ifndef GAMERENDER_H
#define GAMERENDER_H

#include <opencv2/opencv.hpp>
#include <cvui.h>
#include "GameLogic.h"


class GameRender
{
private:
	const cv::Scalar backgroundColor = cv::Scalar(33, 33, 33);
	const int cellOffset = 150;
	const int cellsXY[2] = {100, 100};

public:
	explicit GameRender(const char* windowTitle, int w, int h);

private:
	const char* title;
	cv::Mat context;
	cv::Mat buttonImageSet[3][3];

public:
	int DrawCellsAndGetMouseEvent(const uint8_t* cells);
	void DrawInfo(GameLogic::GameStatue statue, uint8_t player);
	inline bool Update()
	{
		cvui::update();
		cv::imshow(title, context);
		bool quit = cv::waitKey(33) != 27;
		context = backgroundColor;
		return quit;
	}

};


#endif //GAMERENDER_H
